import VueRouter from 'vue-router'
import Vue from 'vue'

Vue.use(VueRouter);

// 1. 定义 (路由) 组件。
// 可以从其他文件 import 进来
//首页
const index =() => import("@/page/dashboard/index");

//登录页面
const login =() => import("@/page/login/login");

//内容部分
const postArticle =() => import("@/page/content/post-article");
const articleManager =() => import("@/page/content/manager-article");
const commentManager =() => import("@/page/content/manager-comment");
const imageManager =() => import("@/page/content/manager-image");

//用户管理
const email =() => import("@/page/user/email");
const info =() => import("@/page/user/info");
const list =() => import("@/page/user/list");
const resetPassword =() => import("@/page/user/reset-password");

//运营管理
const categoryManager =() => import("@/page/operation/category");
const loopManager =() => import("@/page/operation/loop");

//设置
const friendLink =() => import("@/page/settings/friend-link");
const websiteInfo =() => import("@/page/settings/website-info");

//基本布局
const baseView =() => import("@/layout/base-view");
const rightView =() => import("@/layout/right-content");

// 2. 定义路由
export const routes = [
    {
        path: '',
        component: baseView,
        redirect: '/index',
        children:[
            {
                path: '/index',
                name: '首页',
                icon: 'el-icon-help',
                hidden: false,
                component: index
            },
            {
                path: '/content',
                hidden: false,
                name: '内容',
                icon: 'el-icon-document',
                component: rightView,
                children: [
                    {
                        path: 'post-article',
                        hidden: false,
                        name: '发表文章',
                        icon: 'el-icon-edit',
                        component: postArticle
                    },
                    {
                        path: 'manager-article',
                        hidden: false,
                        name: '文章管理',
                        icon: 'el-icon-set-up',
                        component: articleManager
                    },
                    {
                        path: 'manager-comment',
                        hidden: false,
                        name: '评论管理',
                        icon: 'el-icon-chat-line-round',
                        component: commentManager
                    },
                    {
                        path: 'manager-image',
                        hidden: false,
                        name: '图片管理',
                        icon: 'el-icon-picture-outline-round',
                        component: imageManager
                    },
                ]
            },
            {
                path: '/user',
                hidden: false,
                name: '用户',
                icon: 'el-icon-user-solid',
                component: rightView,
                children: [
                    {
                        path: 'list',
                        name: '用户列表',
                        icon: 'el-icon-finished',
                        hidden: false,
                        component: list
                    },
                    {
                        path: 'reset-password',
                        hidden: false,
                        name: '重置密码',
                        icon: 'el-icon-refresh',
                        component: resetPassword
                    },
                    {
                        path: 'email',
                        hidden: false,
                        name: '邮箱管理',
                        icon: 'el-icon-message',
                        component: email
                    },
                    {
                        path: 'info',
                        hidden: false,
                        name: '用户信息',
                        icon: 'el-icon-document-copy',
                        component: info
                    },
                ]
            },
            {
                path: '/operation',
                hidden: false,
                name: '运营',
                icon: 'el-icon-s-promotion',
                component: rightView,
                children: [
                    {
                        path: 'category',
                        name: '分类管理',
                        hidden: false,
                        icon: 'el-icon-paperclip',
                        component: categoryManager
                    },
                    {
                        path: 'loop',
                        name: '轮播管理',
                        hidden: false,
                        icon: 'el-icon-coin',
                        component: loopManager
                    },
                ]
            },
            {
                path: '/settings',
                hidden: false,
                name: '设置',
                icon: 'el-icon-setting',
                component: rightView,
                children: [
                    {
                        path: 'website-info',
                        name: '网站信息',
                        icon: 'el-icon-odometer',
                        hidden: false,
                        component: websiteInfo
                    },
                    {
                        path: 'friend-link',
                        name: '友情链接',
                        icon: 'el-icon-link',
                        hidden: false,
                        component: friendLink
                    },
                ]
            },
        ]
    },
    {
        path: '/login',
        component: login
    }
]

// 3. 创建 router 实例，然后传 `routes` 配置
const router = new VueRouter({
    routes // (缩写) 相当于 routes: routes
})
export default router;